package com.ys.shop.util;

import com.ys.shop.vo.Product;
import com.ys.shop.vo.ShoppingCarGood;

import java.util.List;

public class ShoppingCarUtil {
    //添加商品
    public static void addGood(ShoppingCarGood shoppingCarGood, List<ShoppingCarGood> list){
        if (list.size()==0){
            list.add(shoppingCarGood);
        }else {
        for (int i = 0; i< list.size(); i++) {
            ShoppingCarGood s = list.get(i);
            if (shoppingCarGood.getId() == s.getId()) {
                s.setNum(s.getNum() + 1);
                break;
            } else {

            }
        }
        }
    }
    //修改商品数量


    //删除商品
}
